package com.yonder.gocommand.service.impl;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.yonder.gocommand.dao.ICompanyDAO;
import com.yonder.gocommand.entity.Company;
import com.yonder.gocommand.service.ICompanyService;

@Service("CompanyService")
@Transactional
public class CompanyServiceImpl implements ICompanyService {
	
	private static final Logger LOGGER = LoggerFactory.getLogger(ICompanyService.class);
	private Date currentDateTime = new Date();
	private SimpleDateFormat sdf = new SimpleDateFormat("HH:mm dd/MM/yyyy");
	
	@Autowired
	private ICompanyDAO companyDAO;

	@Override
	public void saveOrUpdate(Company c) {
		LOGGER.info("saveOrUpdate: " + c.getCompanyName() + " " + sdf.format(currentDateTime));
		companyDAO.saveOrUpdate(c);
	}
}
